<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        document.onkeydown = function(e) {
            var key = e.key;
            console.log(e.shiftkey, key);
            switch (key) {
                case "a":
                    if (e.altkey) {
                        console.log("按了alt + a键");
                    }
                    break;
                case "b":
                    if (e.ctrlKey) {
                        console.log("按了b+ctrl按键");
                    }
                    break;
                case "C":
                    console.log(e.shiftKey);
                    if (e.shiftKey) {
                        console.log("按了c+shift按键");
                    }
                    break;
                default:
                    console.log("按了除了a和b的按键");
                    break;
            }
        };
    </script>
</body>

</html>